(function($) {
	$.fn.dialog = function(ele) {
		var $dialog = $('#dialog');
		if ($dialog.length === 0) {
			$dialog = $('<div id="dialog"></div>');
			$('body').append($dialog);
			$dialog.on('click', 'a[dialog-close]', function() {
				$dialog.hide();
			});
		}
		$dialog.html(ele);
		var win_height = $(document).height();
		var content_height = $dialog.children().height();
		$dialog.first().css('paddingTop', (win_height - content_height) / 2 + 'px')
		$dialog.show();
	}
})(jQuery)